#include <stdio.h>
#include <stdlib.h>
#include "ListQueue.h"

// 入队列
int enListQueue(LinkedList *queue, ElemType e) {
    return addLinkedList(queue, e);
}

// 出队列
ElemType deListQueue(LinkedList *queue) {
    if (!verificationLinkedList(queue)) {
        return ' ';
    }
    LinkedList *p = queue;
    ElemType data = ' ';
    if (p->next != NULL) {
        LinkedList *temp = p->next;
        p->next = p->next->next;
        data = temp->data;
        free(temp);
    }
    return data;
}

void listQueueTest(){
    LinkedList *root = initLinkedList();
    enListQueue(root,'a');
    enListQueue(root,'b');
    enListQueue(root,'c');
    enListQueue(root,'d');
    enListQueue(root,'e');

    printf("%c",deListQueue(root));
    printf("%c",deListQueue(root));
    printf("%c",deListQueue(root));
    printf("%c",deListQueue(root));
    printf("%c",deListQueue(root));
    printf("%c",deListQueue(root));
    deListQueue(root);
}